<script th:fragment="authenticateUser">
    var loginUser = null;
    document.addEventListener('DOMContentLoaded', function () {
        fetch('/user/getLoginUser') // 替换为实际API地址
            .then(response => response.json())
            .then(data => {
                if (data != null && data.code === 200){
                    loginUser = data.data;
                }else {
                    window.location.href = '/login.html';
                }
            })
            .catch(error => console.error('Error checking login status:', error));
    });
</script>

